package gcd;

/**
 * Finds Greatest Common Divisor using Euclidian algorithm
 * @author NP
 *
 */
public class EuclidianGCD {

	public static int find(int a, int b) {
		if ((a == 0)||(b == 0)) return -1;
		int t;
		if (a < b) {
			t = b;
			b = a;
			a = t;
		}
		while (b != 0) {
			t = a % b;
			a = b;
			b = t;
		}
		return a;
	}

}
